package reduce.fz.com.reduce.service;

import android.content.Context;

import reduce.fz.com.reduce.R;
import reduce.fz.com.reduce.abstracts.AbResponseListener;
import reduce.fz.com.reduce.bean.Video;
import reduce.fz.com.reduce.bean.VideoCard;
import reduce.fz.com.reduce.bean.VideoCardReply;
import reduce.fz.com.reduce.util.ApiUtil;
import reduce.fz.com.reduce.util.HttpUtils;

/**
 * Created by qingshengzheng on 16/1/9.
 */
public class VideoService {
    private Context context;

    public VideoService(Context context) {
        this.context = context;
    }

    public void getVideo(Long cardid, AbResponseListener listener) {
        String url = ApiUtil.getApi(context, R.array.api_get_video, cardid);
        HttpUtils.get(url, listener);
    }

    /**
     * 秀场视频提交
     *
     * @param listener
     */
    public void submitVideo(VideoCard videoCard, AbResponseListener listener) {
        String url = ApiUtil.getApi(context, R.array.api_video_submit);
        HttpUtils.jsonPost(url, videoCard, listener);
    }

    public void report(Long cardid, AbResponseListener listener) {
        String url = ApiUtil.getApi(context, R.array.api_video_report, cardid);
        HttpUtils.get(url, listener);
    }

    public void videoReply(VideoCardReply videoCardReply, AbResponseListener listener) {
        String url = ApiUtil.getApi(context, R.array.api_video_reply,videoCardReply.cardid);
        HttpUtils.jsonPost(url, videoCardReply, listener);
    }

    public void videoPraiseUserList(Long cardid,AbResponseListener listener)
    {
        String url=ApiUtil.getApi(context,R.array.api_video_praise_user_list,cardid);
        HttpUtils.get(url,listener);
    }


    public void praise(Long uid, Boolean isPraise, AbResponseListener listener) {
        int temp = 1;
        if (isPraise) temp = 1;
        else temp = 0;
        String url = ApiUtil.getApi(context, R.array.api_card_praise, uid, temp);
        HttpUtils.get(url, listener);
    }
}
